class Observer {
  constructor(data) {
    def(data, "__ob__", this, false);
    this.dep = new Dep();
    if (Array.isArray(data)) {
      Object.setPrototypeOf(data, methodProto);
      this.observeArray(data);
    } else {
      this.walk(data);
    }
  }
  observeArray(data) {
    for (let index = 0; index < data.length; index++) {
      observe(data[index]);
    }
  }
  walk(data) {
    for (const key in data) {
      defineReactive(data, key);
    }
  }
}
